<?php

/**
 * ContantInformation form base class.
 *
 * @method ContantInformation getObject() Returns the current form's model object
 *
 * @package    ecrm
 * @subpackage form
 * @author     Saul Santiago
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseContantInformationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'image'                  => new sfWidgetFormTextarea(),
      'email'                  => new sfWidgetFormInputText(),
      'first_name'             => new sfWidgetFormInputText(),
      'last_name'              => new sfWidgetFormInputText(),
      'middle_name'            => new sfWidgetFormInputText(),
      'contact_no'             => new sfWidgetFormInputText(),
      'mobile_no'              => new sfWidgetFormInputText(),
      'total_registration'     => new sfWidgetFormInputText(),
      'birthdate'              => new sfWidgetFormDate(),
      'designation'            => new sfWidgetFormInputText(),
      'address'                => new sfWidgetFormTextarea(),
      'civil_status'           => new sfWidgetFormInputText(),
      'citizenship'            => new sfWidgetFormInputText(),
      'employment_status'      => new sfWidgetFormInputText(),
      'registration_date'      => new sfWidgetFormDateTime(),
      'last_registration_date' => new sfWidgetFormDateTime(),
      'title'                  => new sfWidgetFormInputText(),
      'client_id'              => new sfWidgetFormInputText(),
      'kids'                   => new sfWidgetFormInputText(),
      'contact_source'         => new sfWidgetFormInputText(),
      'ghp_subscriber'         => new sfWidgetFormChoice(array('choices' => array('Yes' => 'Yes', 'No' => 'No'))),
      'mds_subscriber'         => new sfWidgetFormChoice(array('choices' => array('Yes' => 'Yes', 'No' => 'No'))),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'image'                  => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'email'                  => new sfValidatorString(array('max_length' => 100)),
      'first_name'             => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'last_name'              => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'middle_name'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'contact_no'             => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'mobile_no'              => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'total_registration'     => new sfValidatorInteger(array('required' => false)),
      'birthdate'              => new sfValidatorDate(array('required' => false)),
      'designation'            => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'address'                => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'civil_status'           => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'citizenship'            => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'employment_status'      => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'registration_date'      => new sfValidatorDateTime(array('required' => false)),
      'last_registration_date' => new sfValidatorDateTime(array('required' => false)),
      'title'                  => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'client_id'              => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'kids'                   => new sfValidatorInteger(array('required' => false)),
      'contact_source'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'ghp_subscriber'         => new sfValidatorChoice(array('choices' => array(0 => 'Yes', 1 => 'No'), 'required' => false)),
      'mds_subscriber'         => new sfValidatorChoice(array('choices' => array(0 => 'Yes', 1 => 'No'), 'required' => false)),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'ContantInformation', 'column' => array('email')))
    );

    $this->widgetSchema->setNameFormat('contant_information[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ContantInformation';
  }

}
